package com.thomasmoerman.dci3.pbc

import com.thomasmoerman.dci3.domain._
import com.thomasmoerman.dci3.frw._

import java.util.{List => JList}
import org.hibernate.criterion.Restrictions.{eq => equal}

trait PayBillsQueries {
  this: HibernateSessionProvider =>
  
  def findUnpaidBills(person: Person): JList[Bill] = 
	session
	  .createCriteria(classOf[Bill])
	  .add(equal("debtor", person))
	  .add(equal("paid", false))
	  .list.asInstanceOf[JList[Bill]]
  
}